home *** CD-ROM | disk | FTP | other *** search
/ Windows News 2006 October / wn148cd2.iso / Windows / Travailler / QuickZip / quickzip_460013.exe / {app} / Scripts / RelativeRestore.akp < prev    next >
Text File  |  2003-02-07  |  2KB  |  76 lines

  1. //Compare and update the files in <Dir1> and <Dir2>.
  2. //Backup overwrited file to <BackupChanges>.
  3. const Directory2Backup = 'c:\FoldertoRestore\';
  4.       ZipDirectory = 'c:\ZipDir\';
  5. var
  6.     Path1,ZipPath : String;
  7. var aForm : TForm;
  8.     Button1,Button2,ConfirmButton : TButton;
  9.     Edit1,Edit2 : TEdit;
  10.     Label1,Label2 : TLabel;
  11. procedure Button1Click(sender: TObject);
  12. var k : string;
  13. begin
  14.    k := AskDirDialog(Edit1.text);
  15.    if k <> '' then
  16.      Edit1.text := k;
  17. end;
  18. procedure Button2Click(sender: TObject);
  19. var k : string;
  20. begin
  21.    k := AskDirDialog(Edit2.text);
  22.    if k <> '' then
  23.      Edit2.text := k;
  24. end;
  25.  
  26. procedure Continueclick(sender: TObject);
  27. begin
  28.   aForm.Close;
  29. end;
  30. function AskDirectory : boolean;
  31. begin
  32.     Result := False;
  33.     aForm := New_Form(100,100,500,200,'Please Configure and press Continue');
  34.     Label1 := new_Label(aForm,10,40,'Restore Directory : ');
  35.     Edit1 := new_Edit(aForm,140,40,200,20,Directory2Backup);
  36.     Button1 := New_Button(aForm, 350, 40, 100, 20, 'Browse');
  37.     Button1.OnClick := @Button1Click;
  38.     Label2 := new_Label(aForm,10,10,'Backuped (Zip) Directory : ');
  39.     Edit2 := new_Edit(aForm,140,10,200,20,ZipDirectory);
  40.     Button2 := New_Button(aForm, 350, 10, 100, 20, 'Browse');
  41.     Button2.OnClick := @Button2Click;
  42.     ConfirmButton := New_Button(aForm, 350, 130, 100, 30, 'Continue');
  43.     ConfirmButton.Default := True;
  44.     ConfirmButton.ModalResult := mrOK;
  45.     ConfirmButton.OnClick := @Continueclick;
  46.     show_Form(aForm);
  47.     if aForm.modalResult = Mrok then
  48.     begin
  49.     Path1 := AppendSlash(Edit1.text);
  50.     ZipPath := AppendSlash(Edit2.text);
  51.     Result := true;
  52.     end;
  53. end;
  54.  
  55. procedure ReStoreBackup;
  56. var i : integer;
  57. begin
  58.    i := 0;
  59.    Edit2.text := Appendslash(Edit2.text);
  60.    While fileexists(Edit2.text+'Backup'+inttostr(i)+'.zip') do
  61.      begin
  62.        MakeDir(Edit1.text);
  63.        open(Edit2.text+'Backup'+inttostr(i)+'.zip');
  64.        useextrpath(true);
  65.        Extract('*.*',Edit1.text);
  66.        Close;
  67.        i := i + 1;
  68.      end;
  69. end;
  70.  
  71. begin
  72.   if AskDirectory then
  73.    ReStoreBackup;
  74.   Writeln('Completed!');
  75. end.
  76.